/* 设置css样式： ele 节点*/
function setCssProperty(ele, lst) {
	if(ele!=null) {
		if(lst.length == 2) {
			ele.style.setProperty(lst[0], lst[1]);
		}
		else if(lst.length > 2) {
			ele.style.setProperty(lst[0], lst[1], lst[2]);
		}
	}
}

/* 移除节点： ele 节点*/
function removeElement(ele) {
	if(ele!=null) {
		ele.parentNode.removeChild(ele);
	}
}

/* 根据ClassName移除节点：name  ClassName数组*/
function removeByClassName(name) {
	for(n=0; n<name.length; n++) {
		data = document.getElementsByClassName(name[n]);
		for(i=0; i<data.length; i++) {
			removeElement(data[i]);
			console.log(n);
		}
	}
}

ClassName = ["star-btn", "blind_box", "recommend-list"];
removeByClassName(ClassName);

/* 修改CSS样式 */
setCssProperty(document.getElementsByClassName("main loyout layout")[0], ["margin-top", "0px", "important"]);
setCssProperty(document.getElementsByClassName("m_main")[0], ["margin-top", "0px"]); /*https://download.csdn.net/user/weixin_43964993/*/

/* 文件来源 resource-top 加 箭头 > */
breadcrumb_items = document.getElementsByClassName("el-breadcrumb__item");
for(i=0; i<breadcrumb_items.length-1; i++) {
	i_node = document.createElement("i");
	i_node.setAttribute("class","el-breadcrumb__separator el-icon-arrow-right");
	parent = breadcrumb_items[i];
	tmp_node = parent.getElementsByClassName("el-breadcrumb__separator")[0];
	parent.replaceChild(i_node, tmp_node);
}

/*
b = document.createElement("b");
b.textContent = "访问原网页下载文件";
button = document.createElement("button");
button.appendChild(b);
a = document.createElement("a");
a.setAttribute("href","http:\/\/www.baidu.com");
a.appendChild(button);
div = document.createElement("div");
div.setAttribute("style","position: absolute; left: 50%; top: 50%;margin-left: -70px;");
div.appendChild(a);
document.body.appendChild(div);
*/


/*
buttons = document.getElementsByClassName("el-button left-button el-button--warning el-button--medium")
if(buttons.length > 0) {
	b = document.createElement("b");
	b.textContent = "访问原网页下载文件";
	buttons[0].textContent = "";
	buttons[0].appendChild(b);
	parent = buttons[0].parentElement;
	parent.setAttribute("style","margin: auto");
	a = document.createElement("a");
	a.setAttribute("href","http:\/\/www.baidu.com");
	parent.appendChild(a);
	a.appendChild(buttons[0]);
}
*/

